package com.ssm.service;

import com.ssm.dao.UserDao;
import com.ssm.entity.User;
import com.ssm.entity.page.Page;
import com.ssm.util.MybatisUtil;

public class UserServiceImpl implements UserService {

	@Override
	public Page<User> selectByUserPage(int pageNo) {
		UserDao userDao = MybatisUtil.openSession().getMapper(UserDao.class);
		//设置当前页
		Page<User> page = new Page<>(pageNo);
		//设置总记录
		page.setTotalCount(userDao.count());
		//设置数据
		page.setDataList(userDao.selectByPage(page.getStartRow(), page.getPageSize()));
		return page;
	}
}
